package com.framework.system.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.framework.core.log.annotation.AutoLog;
import com.framework.core.result.R;
import com.framework.system.entity.dto.SysLogQueryDTO;
import com.framework.system.entity.vo.SysLogListVO;
import com.framework.system.entity.vo.SysLogVO;
import com.framework.system.service.ISysLogService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 操作日志表  前端控制器
 * </p>
 *
 * @author Kevin
 * @since 2021-07-12
 */
@RestController
@RequestMapping("/system/sysLog")
@AllArgsConstructor
public class SysLogController {

    private ISysLogService sysLogService;

    /**
     * 分页查询
     */
    @GetMapping("/selectPage")
    @SaCheckPermission("system:sysLog:selectPage")
    @AutoLog(module = "操作日志", title = "分页查询")
    public R<Page<SysLogListVO>> page(Page reqPage, SysLogQueryDTO req) {
        return R.success(sysLogService.selectPage(reqPage, req));
    }

    /**
     * 查看
     */
    @GetMapping("/view")
    @SaCheckPermission("system:sysLog:view")
    @AutoLog(module = "操作日志", title = "查看")
    public R<SysLogVO> view(@RequestParam String id) {
        return R.success(sysLogService.view(id));
    }

}

